<template>
	<view>
		<view class="headloanAll">
			<view class="headloanAllTxt" @click="HeadloanAllClick(1)">
				<text style="padding-bottom: 10rpx;" :style="HeadloanAll == 1?'color:#DFAF7F;':'color:#000000;'">综合排序</text>
			</view>
			<view class="headloanAllTxt" @click="HeadloanAllClick(2)">
				<text style="padding-bottom: 10rpx;" :style="HeadloanAll == 2?'color:#DFAF7F;':'color:#000000;'">额度高</text>
			</view>
			<view class="headloanAllTxt" @click="HeadloanAllClick(3)">
				<text style="padding-bottom: 10rpx;" :style="HeadloanAll == 3?'color:#DFAF7F;':'color:#000000;'">通过率高</text>
			</view>
			<view class="headloanAllTxt" @click="HeadloanAllClick(4)">
				<text style="padding-bottom: 10rpx;" :style="HeadloanAll == 4?'color:#DFAF7F;':'color:#000000;'">待提现</text>
			</view>
		</view>
		<view class="loanfirstBox">
			<image src="../../static/champion.png" mode=""></image>
			<view class="youxuandai">优选贷</view>
			<text class="OnekeyCustomized">一键定制高通过率贷款方案</text>
			<view class="loanfirstDesc">
				<view>最高激活可用额度（元）</view>
				<view class="loanfirstNum">200000</view>
				<view>借1千元日息低至3毛 | 快至1分钟放款</view>
			</view>
			<view @click="nowLingqian()" class="CollectMoney">马上领钱</view>
		</view>
		<view class="recommendList" v-for="(item,index) in list" @click="listClick(item.url)">
			<view class="lendingNum">
				<image src="../../static/brandlogo.png" mode=""></image>
				<view class="lendingBrand">{{item.name}}</view>
				<view class="lendingPrice">{{item.quota}}</view>
				<view class="lendingQuota">平均额度（元）</view>
			</view>
			<view class="lendingInfor">
				<view>{{item.info[0]}}</view>
				<view>{{item.info[1]}}</view>
				<view>{{item.info[2]}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {VUE_API_URL} from "@/components/pulugins/index"
	export default {
		data() {
			return {
				HeadloanAll:1,
				list:''
			}
		},
		onShow() {
			this.ProductList();
		},
		methods: {
			HeadloanAllClick(index){
				this.HeadloanAll = index;
			},
			ProductList(){
				var that = this
				uni.request({
				    url: VUE_API_URL + 'product/list', 
					method:'POST',
				    data: {}, 
				    header: {
				        'Authori-zation': 'Bearer ' + uni.getStorageSync('token') //自定义请求头信息
				    },
				    success: (res) => {
						console.log(res);
						that.list = res.data.data.list
				    }
				});
			},
			listClick(url){
				window.location.href=url;
			},
			nowLingqian(){
				uni.navigateTo({		
				    url: '../second/PreferredLoan'
				});
			}
			
		}
	}
</script>

<style>
	page{
		background: #F8F8F8;
	}
	.headloanAll{
		background: #FFFFFF;
		text-align: center;
	}
	.headloanAllTxt{
		font-size: 26rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #444444;
		line-height: 70rpx;
		display: inline-block;
		margin: 0 40rpx;	
	}
	.loanfirstBox{
		width: 618rpx;
		height: 222rpx;
		background: #FFFFFF;
		box-shadow: 0 0 40rpx 0 rgba(0, 0, 0, 0.1);
		border-radius: 20rpx;
		margin: 31rpx auto 30rpx auto;
		padding: 35rpx 40rpx;
		font-family: PingFang SC;
	}
	.loanfirstBox image{
		width: 43rpx;
		height: 23rpx;
		margin-right: 13rpx;
	}
	.youxuandai{
		font-size: 29rpx;
		font-weight: 800;
		color: #CCB895;
		margin-right: 12rpx;
		display: inline-block;
	}
	.OnekeyCustomized{
		font-size: 22rpx;
		font-weight: 500;
		color: #CCB895;
	}
	.loanfirstDesc{
		font-size: 22rpx;
		font-weight: 800;
		color: #444444;
		line-height: 50rpx;
		margin-top: 30rpx;
		display: inline-block;
	}
	.loanfirstNum{
		color: #000000;
		font-size: 66rpx;
		margin-bottom: 10rpx;
	}
	.CollectMoney{
		width: 203rpx;
		height: 64rpx;
		background: linear-gradient(-84deg, #DFBA94, #DFAD7B);
		box-shadow: 0 3rpx 10rpx 0 rgba(0, 0, 0, 0.16);
		border-radius: 32rpx;
		font-size: 28rpx;
		font-weight: bold;
		color: #FFFFFF;
		line-height: 64rpx;
		text-align: center;
		display: inline-block;
		float: right;
		margin-top: 75rpx;
	}
	.recommendList{
		height: 186rpx;
		border-top: 2rpx solid #F8F8F8;
		padding: 20rpx 0 20rpx 50rpx;
		background: #FFFFFF;
	}
	.lendingNum{
		display: inline-block;
		font-family: PingFang SC;
		width: 250rpx;
	}
	.lendingNum image{
		width: 24rpx;
		height: 27rpx;
	}
	.lendingInfor{
		display: inline-block;
		font-size: 26rpx;
		font-family: PingFang SC;
		font-weight: 300;
		color: #000000;
		line-height: 50rpx;
		margin-left: 40rpx;
	}
	.lendingBrand{
		font-size: 28rpx;
		font-weight: bold;
		color: #000000;
		line-height: 30rpx;
		margin-left: 20rpx;
		display: inline-block;
	}
	.lendingPrice{
		font-size: 60rpx;
		font-weight: bold;
		color: #DFAF7F;
		line-height: 100rpx;
	}
	.lendingQuota{
		font-size: 26rpx;
		font-weight: 300;
		color: #000000;
		line-height: 30rpx;
	}

</style>
